package com.lin.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.lin.entity.Info;
import com.lin.mapper.InfoMapper;
import com.lin.service.InfoService;

import java.util.List;

@Service
public class InfoServiceImpl implements InfoService{

    @Resource
    private InfoMapper infoMapper;

    @Override
    public int deleteByPrimaryKey(Long bookid) {
        return infoMapper.deleteByPrimaryKey(bookid);
    }

    @Override
    public int insert(Info record) {
        return infoMapper.insert(record);
    }

    @Override
    public int insertSelective(Info record) {
        return infoMapper.insertSelective(record);
    }

    @Override
    public Info selectByPrimaryKey(Long bookid) {
        return infoMapper.selectByPrimaryKey(bookid);
    }

    @Override
    public int updateByPrimaryKeySelective(Info record) {
        return infoMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Info record) {
        return infoMapper.updateByPrimaryKey(record);
    }

    @Override
    public PageInfo<Info> selAll(Integer booktype,String bookname,Integer isborrowed,Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Info> infos = infoMapper.selAll(booktype,bookname,isborrowed);
        PageInfo pageInfo=new PageInfo<>(infos);
        return pageInfo;
    }

}
